package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Dataset;
import com.briup.recognition.bean.DatasetExample;
import com.briup.recognition.dao.DatasetMapper;
import com.briup.recognition.service.IDatasetService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: ldd
 * @Date: 2021/03/28/19:34
 * @Description:
 */
@Service
public class DatasetServiceImpl implements IDatasetService {

    @Resource
    private DatasetMapper datasetMapper;

    @Override
    public List<Dataset> query(){
        DatasetExample example = new DatasetExample();

        return datasetMapper.selectByExample(example);

    }


    @Override
    public void saveOrUpdate(Dataset dataset){
        if (dataset.getId()!=null){
            datasetMapper.updateByPrimaryKey(dataset);
        }else {
            datasetMapper.insert(dataset);
        }
    }
    @Override
    public void deleteById(long id){datasetMapper.deleteByPrimaryKey((id));}
}

